import { HomeBannerType, homeResultDataType, indexNumberType, responseResult } from "@/types/api";
import axios from "@/utils/request";

/**
 * 获取首页数据
 */
export function getHomeDataAPI() {
    return axios.get<homeResultDataType>("/api/index/index-data");
}
/**
 * 根据子分类查询竞赛
 * @param {string} categoryId categoryId
 * @returns
 */
export function queryContestListByCategoryIdAPI(categoryId: string) {
    return axios.get<responseResult<Object[]>>(`/api/contest/queryContestListByCategoryId/${categoryId}`);
}
/**
 * 首页:根据子分类查询活动
 * @param {string} categoryId categoryId
 * @returns
 */
export function queryActivityListByCategoryId(categoryId: string) {
    return axios.get<responseResult<Object[]>>(`/api/activity/queryActivityListByCategoryId/${categoryId}`);
}

/**
 * 根据name查询banner
 * @param {string} name name
 * @returns
 */
export function getInfo(name: string) {
    return axios.get<responseResult<HomeBannerType>>(`/api/web/carousel/${name}`);
}
/**
 * 查询竞赛，活动，文章的数量
 * @returns
 */
export function findIndexNumber() {
    return axios.get<responseResult<indexNumberType>>(`/api/index/index-number`);
}
